<?php

require_once('lib/tariff.php');
$is_admin = $_SESSION['status_code'] == 'ADMIN';
?>
<script src="pages_admin/club/_club.js" type="text/javascript"></script>
<h3>Tarifs</h3>
<?php echo $is_admin ? '<p class="add"><a href="?p=club&amp;r=tariffs_edit">Ajouter un nouveau tarif</a></p>' : ''; ?>
<table class="dataTable">
	<thead>
	<tr>
		<th>Libellé</th>
		<th>Montant</th>
		<?php echo $is_admin ? '<th>Action</th>' : ''; ?>
	</tr>
	</thead>
	<tbody>
<?php

$tarrifs = tariff_get_list();

while ($row = mysql_fetch_assoc($tarrifs)) {
	$price = sprintf('%0.2f €', $row['price']);
	echo '
	<tr>
		<td>'.$row['label'].'</td>
		<td class="numeric">'.$price.'</td>';
			if ($is_admin) {
				echo '
				<td>
					<a href="?p=club&amp;r=tariffs_edit&amp;id='.$row['id'].'">
						<img src="images/icons/pencil.png" />
					</a>
					<span>
						<a href="javascript:void(0);" class="js-ask-validation" title="Supprimer ce tarif">
							<img src="images/icons/delete.png" alt="supprimer" />
						</a>
						<div class="hidden decalhaut">
							Supprimer définitivement ?<br />
							<a href="javascript:void(0);" class="js-del-tariff b-oui" id="deltariff_'.$row['id'].'"></a>
							<a href="javascript:void(0);" class="js-hide b-non"></a>
						</div>
					</span>
				</td>';
			}
			echo'
	</tr>';
}
?>
	</tbody>
</table>
